package com.chinasoft.carWithuserservice.controller;


import com.chinasoft.carWithuserservice.service.CarWithUserService;
import com.chinasoft.ms.dto.CarDTO;
import com.chinasoft.ms.dto.CarWithUserDTO;
import com.chinasoft.ms.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CarWithUserMicroController {

    @Autowired
    CarWithUserService service;

    @PostMapping("/CarWithUser/add/")
    public int addCarWithUser(@RequestBody CarWithUserDTO carDTO) {
        return service.insert(carDTO);
    }

    @PostMapping("/CarWithUser/{carId}")
    public int deleteCarWithUser(@PathVariable Long carId) {
        return service.deleteByCarIdAndUserId(carId);
    }
}
